package com.gitee.wsl.mathematics.function.scale.continuous.time

import com.gitee.wsl.time.interval.Interval
import com.gitee.wsl.time.interval.Intervals

data class TickInterval(
    val interval: Interval,
    val step: Int,
    val duration: Long
)

internal val durationSecond = 1000L
internal val durationMinute = 60000L
internal val durationHour = 3600000L
internal val durationDay = 86400000L
internal val durationWeek = 604800000L        // (day * 7)
internal val durationMonth = 2592000000L      // (day * 30)
internal val durationYear = 31536000000L      // (day * 365)

internal val tickIntervals:List<TickInterval> by lazy{
    listOf(
        TickInterval(Intervals.timeSecond, 1, durationSecond),
        TickInterval(Intervals.timeSecond, 5, 5 * durationSecond),
        TickInterval(Intervals.timeSecond, 15, 15 * durationSecond),
        TickInterval(Intervals.timeSecond, 30, 30 * durationSecond),
        TickInterval(Intervals.timeMinute, 1, durationMinute),
        TickInterval(Intervals.timeMinute, 5, 5 * durationMinute),
        TickInterval(Intervals.timeMinute, 15, 15 * durationMinute),
        TickInterval(Intervals.timeMinute, 30, 30 * durationMinute),
        TickInterval(Intervals.timeHour, 1, durationHour),
        TickInterval(Intervals.timeHour, 3, 3 * durationHour),
        TickInterval(Intervals.timeHour, 6, 6 * durationHour),
        TickInterval(Intervals.timeHour, 12, 12 * durationHour),
        TickInterval(Intervals.timeDay, 1, durationDay),
        TickInterval(Intervals.timeDay, 2, 2 * durationDay),
        TickInterval(Intervals.timeSunday, 1, durationWeek),
        TickInterval(Intervals.timeMonth, 1, durationMonth),
        TickInterval(Intervals.timeMonth, 3, 3 * durationMonth),
        TickInterval(Intervals.timeYear, 1, durationYear)
    )
}